package fun.fykj.liu.cofig;

import fun.fykj.liu.service.IRecordService;
import fun.fykj.liu.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @version V3.0
 * @Title: SaticScheduleTask
 * @Company: 成都影达科技有限公司
 * @Description: 描述
 * @author: 东进
 * @date 2019/12/20 上午9:15
 */
@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class ScheduleTask {

    @Autowired
    private IRecordService recordService;
    @Autowired
    private IUserService userService;

    //删除记录
    @Scheduled(cron = "0 30 14 * * ?")
    private void configureTasks() {
        recordService.deleteBefore();
    }

    //修改管理员
    @Scheduled(cron = "0 30 02 ? * MON")
    private void changeManager() {
        userService.changeManager();
    }
}
